<?php
include_once 'extension/ckeditor/ckeditor.php' ;
require_once 'extension/ckfinder/ckfinder.php' ;
class Henry_Editor_Ckeditor 
{
	const BASIC = "Basic";
	public function editor($name,$initValue = null,$lang = 'vi',$type = null)
	{
		if ($type == self::BASIC)
		{
			$config = "
				toolbar :
					[
						[ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
						[ 'UIColor' ]
					],
			";
		}
		else 
		{
			$config = "";
		}
		$basePath = BASE_URL.'/extension/ckfinder/';
		$str = "
			<input type=\"button\" class=\"datadefault_ckeditor\" rel=\"$name\" name=\"datadefault$name\" value=\"Trình Bày Mẫu\">
			<textarea cols=\"80\" rows=\"10\" id=\"$name\" name=\"$name\">$initValue</textarea>
			<script type=\"text/javascript\">
				$('#$name').ckeditor({
					$config
					language:'$lang',
					skin : 'office2003'
				});
				var api_$name = CKEDITOR.instances[\"$name\"];
				CKFinder.setupCKEditor( api_$name, '$basePath' ) ;
			</script>
		";
		return $str;
	}
}

?>